<template>
	<div style="width: 100%;height: 100%;" v-if="themeRoute">
		<styleItem1 :themeRoute="themeRoute" v-if="themeRoute.loginStyle===1" @afterLogin="afterLogin"></styleItem1>
		<styleItem2 :themeRoute="themeRoute" v-if="themeRoute.loginStyle===2" @afterLogin="afterLogin"></styleItem2>
		<styleItem3 :themeRoute="themeRoute" v-if="themeRoute.loginStyle===3" @afterLogin="afterLogin"></styleItem3>
		<zk-popup v-if="false"></zk-popup>
	</div>
</template>
<script>
	import styleItem1 from './widget/style-item1'
	import styleItem2 from './widget/style-item2'
	import styleItem3 from './widget/style-item3'
	export default {
		components: {
			styleItem1,
			styleItem2,
			styleItem3
		},
		data() {
			return {
				themeRoute: null
			}
		},
		mounted() {
			this.init()
		},
		methods: {
			async init() {
				var this_ = this
				this.themeRoute = await this.$ala.themeRoute()
				if (this.themeRoute) {
					this.$ala.setTitle(this.themeRoute.name + '登录')
				}
				var isUserType = await this.$ala.userIsUserType()
				if (isUserType) {
					this.$router.push(this.themeRoute.index)
				}
				setTimeout(async () => {
					await this.$ala.securityAdminSign(this_)
					await this.$api.init()
				}, 1000)
				await this.afterLogin()
			},
			// 登录成功以后处理,延迟登录
			async afterLogin() {
				setTimeout(async () => {
					var isUserType = await this.$ala.userIsUserType()
					if (isUserType) {
						this.$router.push(this.themeRoute.index)
					}
				}, 1000)
			}
		}
	}
</script>
<style rel="stylesheet/scss" lang="scss">
	@import "./style.scss";
</style>